package com.wwz.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;


/**
 * <p>Description:历史数据查看</p >
 * 表：
 *   ACT_RU_EXECUTION
 * <p>Copyright: Copyright (c)2021</p >
 * <P>Created Date :2021-04-07</P>
 * <P>@version 1.0</P>
 */
public class BusinessKeyAdd {
    public static void main(String[] args) {
        //1.得到ProcessEngine对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

        //2.得到 runtimeService
        RuntimeService runtimeService = processEngine.getRuntimeService();

        //3.通过runtimeService 启动流程实例 同时指定业务表示 businessKey  比如请假单id
        // 1 流程定义Key  2 业务标识
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holiday", "123");

        //4.输出processInstance 相关属性
        System.out.println(processInstance.getBusinessKey());

    }
}
